credit2: Add context_saved scheduler callback
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 14 Apr 2010 11:03:27 +0000 (12:03 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 14 Apr 2010 11:03:27 +0000 (12:03 +0100)
Because credit2 shares a runqueue between several cpus, it needs
to know when a scheduled-out process has finally been context-switched
away so that it can be added to the runqueue again.  (Otherwise it may
be grabbed by another processor before the context has been properly
saved.)

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/common/schedule.c
xen/include/xen/sched-if.h

index 5b28004cc61857edcc52b908d9fef0c94f2908fe..45d3040728d28b276fc98f1ae165d763e84682a3 100644 (file)
@@ -885,6 +885,8 @@ void context_saved(struct vcpu *prev)
     /* Check for migration request /after/ clearing running flag. */
     smp_mb();
 
+    SCHED_OP(context_saved, prev);
+
     if ( unlikely(test_bit(_VPF_migrating, &prev->pause_flags)) )
         vcpu_migrate(prev);
 }
index ed0575773063a40f2c00d4bf66e279424b7b8196..352e43f5ef7cfdbcefb0b7a6fca2a3e93191a0fb 100644 (file)
@@ -70,6 +70,7 @@ struct scheduler {
 
     void         (*sleep)          (struct vcpu *);
     void         (*wake)           (struct vcpu *);
+    void         (*context_saved)  (struct vcpu *);
 
     struct task_slice (*do_schedule) (s_time_t);